<?php
namespace Home\Controller;
use Think\Controller;

class ExplorerController extends BaseController {
	/**
	 * 随机展示20条
	 * @access public
	 * @since 2014-10-20 20:37:13
	 * @author FrankKung <Frank@kofj.net>
	 */
	public function index() {
		//模型
		$Hash = D('Hash');

		// 随机数据
		$redis= new \Redis();
		$redis->connect('127.0.0.1',6379);
		$randMember = $redis->sRandMember('maindb',20);
		//var_dump($randMember);
		
		$map['hash'] = array('in', $randMember);
		$members = $Hash->where($map)->field('hash,title,file,fileNumber,fileSize,hot')->select();
		$this->assign("list", $members);
		//var_dump($members);

		$this->display();
	}
}